home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / src / editors / AME / Rexx / dicehelp.ame < prev    next >
Encoding:
Text File  |  1994-02-01  |  1.9 KB  |  88 lines

  1. /* $VER: DICEHelp 37.5 (17.2.94)
  2. **      DICEHelp help system for AME
  3. **
  4. **      Rexx script modeled after version by David Joiner
  5. */
  6.  
  7. OPTIONS RESULTS
  8.  
  9. colnum = 1
  10. GETCURSORPOS
  11. if RC = 0 then colnum = subword(RESULT,2,1)+1
  12.  
  13. GETCHAR
  14. if ((RC > 0) | ( result = 'a'X ) | (result = " " ) | (length(result) = 0)) then do
  15.     colnum = 1
  16.     'Requestline "Enter Help search string:  "'
  17.     if (RC > 0) then exit
  18.     end
  19. else do
  20.     GETLINE
  21. end
  22.  
  23. searchstr = RESULT
  24.  
  25.  
  26. hostname = address()            /* Source AME window */
  27. portname = 'DICEHELP'           /* DICEHelp's port name */
  28. tempname = 't:DICEHelp.temp'    /* Temporary file for passing clips */
  29.  
  30. if ~show('p',portname) then do
  31.     address COMMAND 'RUN >NIL: <NIL: DICEHelp REXXSTARTUP'
  32.  
  33.     do i = 1 to 6
  34.         if ~show('p',portname) then do
  35.             address COMMAND 'wait 1'
  36.         end
  37.     end
  38.  
  39.     if ~show('p',portname) then do
  40.         'eprint "DICEHelp program not found!"'
  41.             exit
  42.     end
  43. end
  44.  
  45. address value portname
  46.  
  47. /* Search for string, return <T>empfile */
  48. /* T searchstr */
  49. Z colnum searchstr
  50.  
  51. if RC=0 then do
  52.     refline = RESULT
  53.  
  54.     address value hostname           /* Back to AME */
  55.  
  56.     if LENGTH(refline) <= 0 then do  /* If a NULL line, bail */
  57.             'eprint' "Item" searchstr "not found!"
  58.         exit
  59.     end
  60.  
  61.         if SUBWORD(refline,1,1) = 'E' then do /* error from dicehelp */
  62.         'eprint' subword(refline,2)
  63.             exit
  64.         end
  65.  
  66.     POPUP f 1
  67.         OPEN SUBWORD(refline,2)
  68.     newport = RESULT            /* get the port                        */
  69.     if RC > 0 then do            /* if not there, then error            */
  70.         'EPRINT'  "Error: error opening doc file " || "refline"
  71.         address command "Wait 6"
  72.         exit
  73.     end
  74.         address value newport           /* Address the new window */
  75.  
  76.     /* Parse var refline '"' docfile '"' docline . refline */
  77.     exit
  78. end
  79. else if RC=1 then do
  80.     address value hostname
  81.     'eprint' "Item" searchstr "not found!"
  82. end
  83. else do
  84.     address value hostname
  85.     'eprint' "Error code" RC "DICEHelp failed!"
  86. end
  87.  
  88.